package com.fingard.dsp.bank.reqrespobj.batrecrefund.detail;

import java.text.ParseException;
import java.util.Date;

import com.fingard.constant.Format;
import com.fingard.text.StringHelper;
import com.fingard.xml.XElement;

public class ReqRecRefundDetail {
	/** 资金退保支付流水号 */
	public String askNumber;

	/** 渠道退保订单号 */
	public String oriOppOrderNo;

	/** 商户退保申请流水号 */
	public String refundNo;

	/** 保全号 */
	public String proposalNo;

	/** 保单号 */
	public String srcNoteCode;

	/** 收方账号 */
	public String recAct;

	/** 收方户名 */
	public String recName;

	/** 收方币种 */
	public String recCur;

	/** 收方银行编码 */
	public String recBankCode;

	/** 收方银行名称 */
	public String recBankName;

	/** 付款日期(格式: yyyy-MM-dd) */
	public String payDate;

	/** 付款时间(格式: HH:mm:ss) */
	public String payTime;

	/** 退保申请金额 */
	public String applyAmt;

	/** 退保手续费 */
	public String fee;

	/** 收益 */
	public String profit;

	/** 实际退保金额 */
	public String payAmount;

	/** 支付渠道 */
	public String payChannel;

	/** 退保审批结果(1-成功,0-失败) */
	public String refundFlag;

	/** 退保审批失败原因 */
	public String refundDesc;

	/** 退保类型(1：犹豫期外不收手续费 2：犹豫期外收手续费 4：犹豫期内不收手续费) */
	public String refundType;

	/** 退保份额 */
	public String refundShare;

	/** 退保剩余价值 */
	public String remainValue;

	/** 用户ID */
	public String userId;

	/** 产品ID */
	public String productId;

	public XElement srcXElement;

	public ReqRecRefundDetail(XElement p_xelement) throws Exception {
		srcXElement = p_xelement;
		askNumber = p_xelement.getSingleText("PostScript");
		oriOppOrderNo = p_xelement.getSingleText("OriOppOrderNo");
		refundNo = p_xelement.getSingleText("RefundNo");
		proposalNo = p_xelement.getSingleText("ProposalNo");
		srcNoteCode = p_xelement.getSingleText("SrcNoteCode");
		if(StringHelper.isNullOrEmpty(srcNoteCode)){
			srcNoteCode = p_xelement.getSingleText("SourceNoteCode");
		}
		recAct = p_xelement.getSingleText("RecAct");
		recName = p_xelement.getSingleText("RecName");
		recCur = p_xelement.getSingleText("RecCur");
		recBankCode = p_xelement.getSingleTextNotNull("RecBankCode");
		recBankName = p_xelement.getSingleTextNotNull("RecBankName");
		payDate = p_xelement.getSingleText("PayDate");
		payTime = p_xelement.getSingleText("PayTime");
		applyAmt = p_xelement.getSingleText("ApplyAmt");
		fee = p_xelement.getSingleText("Fee");
		profit = p_xelement.getSingleText("Profit");
		payAmount = p_xelement.getSingleText("PayAmount");
		payChannel = p_xelement.getSingleText("PayChannel");
		refundFlag = p_xelement.getSingleText("RefundFlag");
		refundDesc = p_xelement.getSingleText("RefundDesc");
		refundType = p_xelement.getSingleText("RefundType");
		refundShare = p_xelement.getSingleText("RefundShare");
		remainValue = p_xelement.getSingleText("RemainValue");
		userId = p_xelement.getSingleText("UserId");
		productId = p_xelement.getSingleText("ProductId");
	}

	public Date getPayDateTime() throws ParseException {
		return Format.DateTimeFormat.parse(payDate + " " + payTime);
	}
}
